package com.bc.bcapi.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.math.BigInteger;

import com.bc.bcapi.dao.T_BalanceMapper;
import com.bc.bcmodel.domain.T_BalanceModel;

/**
 * @Name T_BalanceService * @Description * @Author generation * @Date 2018/8/14 15:26:22 * @Version 1.0
 **/
@Service
public class T_BalanceService {
    @Resource
    T_BalanceMapper t_BalanceMapper;

    /**
     * 保存单条数据     *      * @return
     */
    
    public int insert(T_BalanceModel req) {
        return t_BalanceMapper.insert(req);
    }

    /**
     * 批量增加数据     *      * @return
     */
    
    public int insertBatch(List<T_BalanceModel> req) {
        return t_BalanceMapper.insertBatch(req);
    }

    /**
     * 根据对象属性查找满足条件的第一条数据     *      * @return
     */
    
    public T_BalanceModel findByNamedParam(T_BalanceModel req) {
        return t_BalanceMapper.findByNamedParam(req);
    }

    /**
     * 根据对象查询所有数据     *      * @return
     */
    
    public List<T_BalanceModel> getAllList(T_BalanceModel req) {
        return t_BalanceMapper.findByNamedParamList(req);
    }

    /**
     * 根据对象查询所有分页数据     *      * @return
     */
    
    public PageInfo<T_BalanceModel> getList(T_BalanceModel req) {
        PageHelper.startPage(req.getPage_index(), req.getPage_size());
        List<T_BalanceModel> list = t_BalanceMapper.findByNamedParamList(req);
        return new PageInfo<T_BalanceModel>(list);
    }

    /**
     * 更新指定对象     *      * @return
     */
    
    public int update(T_BalanceModel req) {
        return t_BalanceMapper.update(req);
    }

    /**
     * 删除指定数据     *      * @return
     */
    
    public int delete(BigInteger id) {
        return t_BalanceMapper.delete(id);
    }

    /**
     * 根据条件统计数据量     *      * @return
     */
    
    public long count(T_BalanceModel req) {
        return t_BalanceMapper.count(req);
    }
}